package com.ck.client.service.impl;

import com.ck.client.dao.SysConfigMapper;
import com.ck.client.service.SysConfigService;
import com.ck.common.model.Sysconfig;
import com.ck.core.constant.CacheConstant;
import com.ck.core.constant.SysConfigNameEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: zhanglei
 * @date: 2019/5/5 13:55
 */
@Service("sysconfigService")
public class SysConfigServiceImpl implements SysConfigService {

    @Autowired
    private SysConfigMapper sysConfigMapper;

    @Override
    @Cacheable(value = CacheConstant.CACHE_NAME_CK_SPRING_CACHE_SYS_CONFIG,key = "#config.getType()")
    public Sysconfig getByType(SysConfigNameEnum config) {
        // todo  add spring cache
        Sysconfig sysconfig = sysConfigMapper.getByType(config.getType());
        return sysconfig;
    }
}
